﻿<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>消息中心</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
        <meta content="telephone=no" name="format-detection"/>
        <link href="/css/styles.css" rel="stylesheet" type="text/css"/>
        <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
        <link rel="stylesheet" href="/css/reset.css">
        <script src="/js/jquery/jquery.min.js"></script>
        <script src="/js/plugins/jrender/jrender.min.js"></script>
        <script src="/js/plugins/jquery-form/jquery.form.js"></script>
        
        <script>
            $(function () {
                //先接收共享过来的用户数据
                var userStr = sessionStorage.getItem("user")
                var user = JSON.parse(userStr);
                console.log(user.id);
                $.get("/users/"+user.id+"/like",function (data) {

                    console.log(data);
                    $(".aui-scrollView").renderValues({list:data})
                    //判断是点赞游记还是评论
                    $.each(data,function (index, ele) {
                        //状态为1是游记
                        if (ele.state == 1) {
                            $($(".aui-layout-item")[index]).attr("href","/travelContent.html?id="+ele.bindId)
                        }else{
                            $($(".aui-layout-item")[index]).attr("href","/strategyComment.html?id="+ele.bindId)
                        }
                    })
                })
                //把点赞标记已读
                $.post("/users/"+user.id+"/setLikeHasRead", function (data) {
                    console.log(data.success);
                })



            })
        </script>
    </head>
    <body>
        <section class="aui-flexView">
            <header class="aui-navBar aui-navBar-fixed">
                <div class="col">
                    <a href="/mine/message.html">
                        <span><i class="fa fa-chevron-left" ></i></span>
                    </a>
                </div>
                <div class="aui-center">
                    <span class="aui-center-title">消息中心</span>
                </div>
                <a href="javascript:;" class="aui-navBar-item">
                    <i class="icon icon-member"></i>
                </a>
            </header>
            <section class="aui-scrollView">
                <div class="aui-layout" render-loop="list">
                    <a href="javascript:void(0);" class="aui-layout-item">
                        <div class="aui-layout-item-img">
                            <img render-src="list.liker.headImgUrl" alt="">
                        </div>
                        <div class="aui-layout-item-text">
                            <h4 render-html="list.liker.nickName"></h4>
                            <p render-html="list.stateName"></p>
                        </div>
                    </a>

                </div>
            </section>
        </section>
    </body>
</html>
